package cn.cyh.product.service.impl;

import cn.cyh.basic.service.impl.BaseServiceImpl;
import cn.cyh.product.domain.Product;
import cn.cyh.product.mapper.ProductMapper;
import cn.cyh.product.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

@Service
public class ProductServiceImpl extends BaseServiceImpl<Product> implements IProductService{
    @Autowired
    private ProductMapper productMapper;

    /**
     * 批量上架
     * @param ids
     */
    @Override
    public void onSale(List<Long> ids) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("ids",ids);
        map.put("onSaleTime",new Date());
        productMapper.onSale(map);
    }

    /**
     * 批量下架
     * @param ids
     */
    @Override
    public void offSale(List<Long> ids) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("ids",ids);
        map.put("offSaleTime",new Date());
        productMapper.offSale(map);
    }
}
